<?php
session_cache_expire(999999999);
if (!isset($_SESSION)) {
    session_start();
}
$lang = $_SESSION['lang'];
require_once('calendar/classes/tc_calendar.php');
if (empty($lang) || $lang == "EN") {
    include "value/value_en.php";
} else if ($lang == "VN") {
    include "value/value_vn.php";
} else {
    include "value/value_kr.php";
}
include 'generallibraries/funcs.php';
include 'operations/connection.php';
$fromdate = date("Y-m-d");
$page = 1;
$sqlTax = generalFunctions::listTax($_SESSION['lang']);
$mangTax = mysql_query($sqlTax);
$_REQUEST['rtype'] = "Purchase";
$_REQUEST['abc'] = "1";
$_SESSION['thucthi'] = "new";
$_SESSION['checknamecus'] = "okk";
?>
<link href="calendar/calendar.css" rel="stylesheet" type="text/css" />

<script language="javascript" src="calendar/calendar.js"></script>
<div class="head_info"><?php echo $l_customer; ?></div>
<div style="margin:5px 5px 10px 7px">
    <div style="text-align: left;font-size:12px;font-weight:bold" id="viewdate">
        <table style="padding-bottom:10px;padding-top:5px;margin:center;width:100%;">
            <tr>
                <td>
                    <div style="width:100%;text-align:center;">
                        <input id="AddNew" onclick="addnew('<?= $_SESSION['thucthi'] ?>','<?php echo $_SESSION['checknamecus']; ?>');" name="AddNew" style="margin-right:3px" type="button" value="<?php echo $l_add; ?>" class="btnupbg btnupload" />
                        <input id="Update" onclick="update('<?= $_SESSION['thucthi'] ?>','<?= $_SESSION['idcusupdel'] ?>','<?php echo $_SESSION['checknamecus']; ?>',<?= $page ?>);" name ="Update" style="margin-right:3px" type="button" value="<?php echo $l_update; ?>" class="btnupbg btnupload" />
                        <input id="Delete" onclick="deleteone('<?= $_SESSION['thucthi'] ?>','<?= $_REQUEST["abc"] ?>','<?= $_SESSION['idcusupdel'] ?>');" name ="Delete" style="margin-right:3px" type="button" value="<?php echo $l_delete; ?>" class="btnupbg btnupload" />
                        <input id="ResetNew" name="ResetNew" type="button" value="<?php echo $l_reset; ?>" class="btnupbg btnupload" onclick="resetvalue1(document.accsetupcus.list);"/>
                    </div>
                </td>
            </tr>
            <tr>
                <td>
                    <div style="width:100%;text-align:center;color:green;font-weight: bold;padding-top: 5px;padding-bottom: 5px;" id="viewketquathucthi">
                    </div>
                </td>
            </tr>
        </table>
        <table>
            <tr>
                <td ><span><b><?php echo $l_Transactionregistrydate; ?> :</b></span></td>
                <td style="padding-left:3px;">
<?php
$myCalendar1 = new tc_calendar("trandate", true);
$myCalendar1->setIcon("calendar/images/iconCalendar.gif");
$d = split('-', $fromdate, 3);

$myCalendar1->setDate($d[2], $d[1], $d[0]);
$myCalendar1->setPath("calendar/");
$myCalendar1->setYearInterval(2010, 2015);
$myCalendar1->dateAllow('2010-01-01', '2015-12-31');
//$myCalendar1->setHeight(350);
//$myCalendar1->autoSubmit(true, "form1");
//$myCalendar1->setSpecificDate(array("2011-04-01", "2011-04-13", "2011-04-25"), 0, 'month');
$myCalendar1->setOnChange("myChanged('test')");
//$myCalendar->rtl = true;
$myCalendar1->writeScript();

//echo $myCalendar1->getDate();
?>
                </td>
            </tr>
        </table>
    </div>
    <div style="margin: 10px 7px 5px 3px; color: #508E21; border-bottom: 1px dotted silver"> <?php echo $l_CompanyDetails; ?> </div>
    <table style="border-bottom: 1px dotted silver; padding:10px 5px" width="100%">
        <tr>
            <td class="tdfirst"><?php echo $l_company_name; ?>:</td>
            <td><input type="text" onkeypress="return enterTable(event,this.id);" onchange="checkname(this.value);"  name="txtcomname" id="txtcomname" class="in_testfield" style="width:516px;" /></td>
        </tr>
        <tr>
            <td></td>
            <td id="viewerr" style="color:red; font-weight: bold;"><input type="hidden" id="lienngo" value="<?= $_SESSION[checknamecus] ?>"/></td>
        </tr>
        <tr>
            <td class="tdfirst"><?php echo $l_address; ?>:</td>
            <td><input type="text" onkeypress="return enterTable(event,this.id);" name="txtaddress" id="txtaddress" class="in_testfield" style="width:516px" /></td>
        </tr>
        <tr>
            <td class="tdfirst"><?php echo $l_Website; ?>:</td>
            <td><input type="text" onkeypress="return enterTable(event,this.id);" name="txtwebsite" id="txtwebsite" class="in_testfield" style="width:516px" /><span style="font-size:11px; color:#424242; padding-left:10px">eg. http://www.elisoft.com, http://www.google.com</span> </td>
        </tr>
        <tr>
            <td class="tdfirst"><?php echo $l_CompanyNumber; ?>:</td>
            <td><input type="text" onkeypress="return enterTable(event,this.id);" name="txtcomnum" id="txtcomnum" class="in_testfield" style="float:left;" />
                <span style="background: #E8E8E8;float: left;margin-left: 3px;padding: 5px;width: 80px;"> <?php echo $l_tax; ?> : </span>
                <select id="cbtax" onkeypress="return enterTable(event,this.id);" name="cbtax" style="width:120px; height:22px; margin-left:3px">
<?php
if (mysql_num_rows($mangTax) > 0) {
    while ($row = mysql_fetch_array($mangTax)) {
        ?>
                            <option value="<?= $row[TaxID]; ?>"
                            <?php
                            if ($_REQUEST['cbtax'] == $row[TaxID]) {
                                ?>
                                        selected="selected"
                                <?php
                            }
                            ?>
                                    ><?php echo $row[TaxName]; ?></option>
                                    <?php
                                }
                            }
                            ?>
                </select>
            </td>
        </tr>
        <tr>
            <td class="tdfirst"><?php echo $l_Companytype12; ?>:</td>
            <td><input type="text" onkeypress="return enterTable(event,this.id);" name="txtcomtype121" id="txtcomtype121" class="in_testfield" style="width:250px" />
                /
                <input style="width:250px" onkeypress="return enterTable(event,this.id);" type="text" name="txtcomtype122" id="txtcomtype122"  class="in_testfield" /></td>
        </tr>
        <tr>
            <td class="tdfirst"><?php echo $l_Companytype; ?>:</td>
            <td>
                <table width="80%">
                    <tr>
                        <td><input type="radio" id="rtype" name="rtype"  onkeypress="return enterTable(event,this.id);" value="Purchase" <?php if ($_REQUEST["rtype"] == "Purchase")
                                echo "checked"; ?> /><?php echo $l_Buys; ?></td>
                        <td><input type="radio" id="rtype" name="rtype"  onkeypress="return enterTable(event,this.id);" value="Sale" <?php if ($_REQUEST["rtype"] == "Sale")
                                echo "checked"; ?> /><?php echo $l_Sales; ?></td>
                        <td><input type="radio" id="rtype" name="rtype"  onkeypress="return enterTable(event,this.id);" value="CaHai" <?php if ($_REQUEST["rtype"] == "CaHai")
                                echo "checked"; ?> /><?php echo $l_Buyandsale; ?></td>
                        <td><input type="radio" id="rtype" name="rtype"  onkeypress="return enterTable(event,this.id);" value="CreditCard" <?php if ($_REQUEST["rtype"] == "CreditCard")
                                echo "checked"; ?> /><?php echo $l_Creditcard; ?></td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    <div style="margin: 10px 7px 5px 3px; color: #508E21; border-bottom: 1px dotted silver"> <?php echo $l_Contactperson; ?> </div>
    <table style="border-bottom: 1px dotted silver; padding:10px 5px" width="100%">
        <tr>
            <td class="tdfirst"><?php echo $l_Contactperson; ?>:</td>
            <td><input type="text" onkeypress="return enterTable(event,this.id);" name="txtcontactperson" id="txtcontactperson" class="in_testfield" style="width:516px" /></td>
        </tr>
        <tr>
            <td class="tdfirst"><?php echo $l_email; ?>:</td>
            <td><input type="text" onkeypress="return enterTable(event,this.id);" name="txtmail" id="txtmail" class="in_testfield" style="float:left;width:280px;" />
                <span style="background: #E8E8E8;float: left;margin-left: 3px;padding: 5px;width: 70px;"> <?php echo $l_Fax; ?> : </span>
                <input type="text" onkeypress="return enterTable(event,this.id);" name="txtfax" id="txtfax" class="in_testfield" style="width:148px; margin-left:3px"  />
            </td>
        </tr>
        <tr>
            <td class="tdfirst"><?php echo $l_phone; ?>:</td>
            <td><input type="text" onkeypress="return enterTable(event,this.id);" name="txtphone" id="txtphone" class="in_testfield" style="float:left;width:200px;" />
                <span style="background: #E8E8E8;float: left;margin-left: 3px;padding: 5px;width: 100px;"> <?php echo $l_mobile; ?> : </span>
                <input type="text" onkeypress="return enterTable(event,this.id);" name="txtmobile" id="txtmobile" class="in_testfield" style="width:198px; margin-left:3px"  />
            </td>
        </tr>
        <tr>
            <td class="tdfirst"><?php echo $l_description; ?>:</td>
            <td><textarea name="txtdes" onkeypress="return enterTable(event,this.id);" id="txtdes" style="width:515px; height:50px" rows="4" cols="4"></textarea></td>
        </tr>
    </table>
    <table bgcolor="#e8e8e8" width="100%" style="padding:20px 10px">
        <tr>
            <td width="180"><?php echo $l_Activestatus; ?></td>
            <td><input type="radio"  name="abc" value="1" <?php if ($_REQUEST["abc"] == "1")
                                echo "checked"; ?> /> <?php echo $l_yes; ?> <input type="radio" name="abc"  value="0" <?php if ($_REQUEST["abc"] == "0")
                                echo "checked"; ?>/> <?php echo $l_No; ?></td>
        </tr>

    </table>
</div>
<?php mysql_close($connection); ?>